<template>
  <header class="header">
    <div class="title" @click="onClick">主轴电机数据分析</div>
    <div class="text">
      <el-button type="primary" @click="open">{{ text }}</el-button>
    </div>
  </header>
</template>

<script>
import { ElMessageBox } from "element-plus";
import { WarningFilled } from "@element-plus/icons-vue";
import { markRaw } from "vue";
export default {
  name: "Head",
  data() {
    return {
      text: "历史数据",
    };
  },
  methods: {
    open() {
      this.$emit("change");
      this.text = this.text === "历史数据" ? "返回" : "历史数据";
    },
    onClick() {
      ElMessageBox.alert("振动速度异常", "警告", {
        confirmButtonText: "OK",
        callback: () => {
          this.isMessageBoxShow = false;
        },
        type: "error",
        icon: markRaw(WarningFilled),
      });
    },
  },
};
</script>

<style scoped>
.header {
  height: 80px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-shrink: 0;
  flex-direction: column;
}
.text {
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  padding: 0 30px;
}
.title {
  width: 100%;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}
</style>